<script setup lang="ts">
defineOptions({
  name: "fabBoardModelBoxItem"
});

import { useSlots } from "vue";

const slots = useSlots();

const props = withDefaults(defineProps<{ title: string }>(), { title: "" });
</script>

<template>
  <div class="fab-board-model-box-item">
    <div v-if="!!title || !!slots?.headLeft || !!slots?.headRight" class="item-head">
      <div class="head-slot-left">
        <slot name="headLeft" />
      </div>
      <div class="head-center">
        {{ title }}
      </div>
      <div class="head-slot-right">
        <slot name="headRight" />
      </div>
    </div>
    <div :style="{ height: title ? 'calc(100% - 24px)' : '100%' }">
      <slot />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.fab-board-model-box-item {
  width: 100%;
  height: 100%;

  .item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 24px;

    .head-slot-left {
      width: fit-content;
      min-width: 44px;
    }

    .head-slot-right {
      width: fit-content;
      min-width: 44px;
    }

    .head-center {
      display: flex;
      justify-content: center;
      width: fit-content;
      min-width: 44px;
      height: 0;
      margin-top: -12px;
      font-size: 12px;
      font-weight: 600;
      color: #333;
      text-align: center;
    }
  }
}
</style>
